package com.hzeport.bgs22emduty.inbound.api;

import com.hzeport.bgs22emduty.dto.PersonInfoDTO;
import com.hzeport.bgs22emduty.service.BasePersonInfoService;
import com.hzeport.bgs22emduty.vo.base.PageVO;
import com.hzeport.bgs22emduty.vo.base.PersonInfoData;
import com.hzeport.bgs22emduty.vo.base.PersonInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@AllArgsConstructor
@RequestMapping("/phoneSync")
@Api(value = "phoneSync", tags = "通讯录同步")
@Slf4j
public class PhoneSyncController {

    private final BasePersonInfoService basePersonInfoService;

    @ApiOperation(value = "通讯录同步", notes = "通讯录同步")
    @PostMapping("/getInfo")
    public PersonInfoVO<List<PersonInfoData>> getPersonInfo(@RequestParam String appKey,
                                                            @RequestParam String signature,
                                                            @RequestParam String timestamp,
                                                            @RequestBody PageVO pageVO) {
        PersonInfoDTO personInfoDTO=new PersonInfoDTO();
        personInfoDTO.setAppKey(appKey);
        personInfoDTO.setSignature(signature);
        personInfoDTO.setTimestamp(timestamp);
        personInfoDTO.setPageNum(pageVO.getPageNum());
        personInfoDTO.setPageSize(pageVO.getPageSize());
        return basePersonInfoService.getPersonInfo(personInfoDTO);
    }

}
